<?php
class Portfoliomanager_Model_Updateportfolioitem implements Portfoliomanager_Model_Mainable{
    
    private $core_controller_csrftoken;
    private $core_controller_notnull;
    
    private $excepted_result = 1;
    private $actual_result;
    
    private $portfoliomanager_data_updateportfoliosettings;
    private $portfoliomanager_data_updateportfoliometavalues;
    private $portfoliomanager_data_updateportfoliocontentvalue;
    
    private $update_portfolio_settings_result;
    private $update_portfolio_meta_values_result;
    private $update_portfolio_content_values_result;
    
    public function main(array $variables = null) {
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        $this->core_controller_csrftoken = new Core_Controller_Csrftoken;
        $this->core_controller_csrftoken->main(['post']);
        
        $this->portfoliomanager_data_updateportfoliosettings = new Portfoliomanager_Data_Updateportfoliosettings;
        $this->update_portfolio_settings_result = $this->portfoliomanager_data_updateportfoliosettings->main($variables);
        $this->portfoliomanager_data_updateportfoliometavalues = new Portfoliomanager_Data_Updateportfoliometavalues;
        $this->update_portfolio_meta_values_result = $this->portfoliomanager_data_updateportfoliometavalues->main($variables);
        $this->portfoliomanager_data_updateportfoliocontentvalue = new Portfoliomanager_Data_Updateportfoliocontentvalue;
        $this->update_portfolio_content_values_result = $this->portfoliomanager_data_updateportfoliocontentvalue->main($variables);
        
        if(
                ($this->update_portfolio_settings_result == $this->excepted_result) &&
                ($this->update_portfolio_meta_values_result == $this->excepted_result) &&
                ($this->update_portfolio_content_values_result == $this->excepted_result)
                ){
            header("Location: ".SITE_ROOT."zarzadzaj-portfolio.html");
        }
        else {
            header("Location: ".SITE_ROOT."zarzadzaj-portfolio.html");
        }
    }
}
